|
|
 |
|
|
|
|
' the ordered_faces collection. For i = Faces.Count To 1 Step -1
If Faces(i).IsCulled Then
ordered_faces.Add Faces(i)
Faces.Remove i
End If
Next i
' Order the remaining faces. max_switches = Faces.Count
Do While Faces.Count > 0 ' Get the first item's extent. Set face_1 = Faces(1)
face_1.GetExtent Xmin, xmax, ymin, ymax, zmin, zmax
' Compare this face to the others. overlap = False ' In case Face.Count = 0. For i = 2 To Faces.Count
Set face_i = Faces(i)
' Get item i's extent. face_i.GetExtent xmini, xmaxi, _
ymini, ymaxi, zmini, zmaxi
overlap = True
If xmaxi <= Xmin Or xmini >= xmax Or _
ymaxi <= ymin Or ymini >= ymax Or _
zmini >= zmax
Then ' The extents do not overlap. overlap = False
ElseIf face_i.IsAbove(face_1) Then ' Face i is all above the plane
' of face 1. overlap = False
ElseIf face_1.IsBelow(face_i) Then ' Face 1 is all beneath the plane
' of face i. overlap = False
ElseIf Not face_1.Obscures(face_i) Then ' If face_1 does not lie partly above
' face_i, then there is no problem. overlap = False
End If
If overlap Then Exit For
Next i
If overlap And switches < max_switches Then ' There's overlap, move face i to the
' top of the list. Faces.Remove i
Faces.Add face_i, , 1 ' Before position 1. |
|
|
|
|
|